package ooexercise03;
/*
public class Test {
    public static void main(String[] args) {

        Dog dog = new Dog("小黑",2,"黑");
        dog.eat();
        dog.lookHome();
        dog.drink();
        dog.swim();

        Chick chick = new Chick("小黄",1,"黄");
        chick.eat();
        chick.drink();
        chick.layEgg();
        chick.swim();

        Fish fish = new Fish("小红",2,"红");
        fish.eat();
        fish.drink();
        fish.swim();



        Dog[] dog = new Dog[3];
        dog[0] = new Dog("小黑",3,"黑");
        dog[1] = new Dog("小白",2,"白");
        dog[2] = new Dog("小灰",1,"灰");
        for(int i=0;i< dog.length;i++){
            System.out.println(dog[i].name);
            dog[i].lookHome();
        }

        Chick[] chicks = new Chick[2];
        chicks[0] = new Chick("小黄",2,"黄");
        chicks[1] = new Chick("小棕",1,"棕");
        for(int i=0;i< chicks.length;i++){
            System.out.println(chicks[i].age);
            chicks[i].layEgg();
        }

        Fish[] fish = new Fish[4];
        fish[0] = new Fish("小金",1,"金");
        fish[1] = new Fish("小红",1,"红");
        fish[2] = new Fish("小绿",1,"绿");
        fish[3] = new Fish("小蓝",1,"蓝");
        for (int i=0;i< fish.length;i++){
            System.out.println(fish[i].colour);
            fish[i].swim();
        }
    }
}

 */

public class Test {
    public static void main(String[] args) {
        /*
        Dog dog = new Dog("小灰",5,"灰");
        dog.eat();
        dog.drink();
        dog.swim();
        dog.lookHome();

        Chick chick = new Chick("小黄",4,"黄");
        chick.eat();
        chick.drink();
        chick.layEgg();
        chick.swim();

        Fish fish = new Fish("小黑",6,"黑");
        fish.eat();
        fish.drink();
        fish.swim();

         */

        Dog[] dogs = new Dog[3];
        dogs[0] = new Dog("小黑",4,"黑");
        dogs[1] = new Dog("小白",2,"白");
        dogs[2] = new Dog("小灰",3,"灰");
        for (int i=0;i< dogs.length;i++){
            System.out.println(dogs[i].name);
            dogs[i].lookHome();
        }

        Chick[] chicks = new Chick[2];
        chicks[0] = new Chick("小黄",1,"黄");
        chicks[1] = new Chick("小灰",2,"灰");
        for (int i=0;i< chicks.length;i++){
            System.out.println(chicks[i].age);
            chicks[i].layEgg();
        }

        Fish[] fish = new Fish[4];
        fish[0] =new Fish("小红",3,"红");
        fish[1] =new Fish("小金",3,"金");
        fish[2] =new Fish("小绿",3,"绿");
        fish[3] =new Fish("小蓝",3,"蓝");
        for (int i=0;i< fish.length;i++){
            System.out.println(fish[i].colour);
            fish[i].swim();
        }
    }
}

